import request from '@/utils/request.js'

/**
 * 请求月卡列表
 * @param {*} params
 * @returns
 */
export function getCardListAPI(params) {
  return request({
    url: '/parking/card/list',
    params
  })
}

/**
 * 添加月卡
 * @param {*} data
 * @returns
 */
export function addCardAPI(data) {
  return request({
    url: '/parking/card',
    method: 'POST',
    data
  })
}

/**
 * 获取编辑月卡详情
 * @param {*} id
 * @returns
 */
export function getEditCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}

/**
 * 编辑月卡
 * @param {*} data
 * @returns
 */
export function editCardAPI(data) {
  return request({
    url: '/parking/card/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除月卡
 * @param {*} id
 * @returns
 */
export function delCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}

/**
 * 批量删除月卡
 * @param {*} ids
 * @returns
 */
export function delMultiCardAPI(ids) {
  return request({
    url: `/parking/card/${ids.join(',')}`,
    method: 'DELETE'
  })
}

/**
 * 续费月卡
 * @param {*} data
 * @returns
 */
export function renewCardAPI(data) {
  return request({
    url: '/parking/card/recharge',
    method: 'POST',
    data
  })
}

/**
 * 查看月卡详情
 * @param {*} id
 * @returns
 */
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/${id}`
  })
}
